﻿using LowCoding.Application.Sys.Module;
using LowCoding.Common;
using LowCoding.Dto.Sys;
using Microsoft.AspNetCore.Mvc;

// For more information on enabling Web API for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860

namespace LowCoding.API.Controllers.sys.Module
{
    /// <summary>
    /// 菜单API√
    /// </summary>
    [Route("api/[controller]")]
    [ApiController]
    public class SysModuleController : BaseController
    {
        private readonly ISysModuleService _sysmoduleservice;

        public SysModuleController(ISysModuleService sysmoduleservice)
        {
            _sysmoduleservice = sysmoduleservice;
        }

        /// <summary>
        /// 查询树形菜单信息√
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [Route("gettreemodule"), HttpGet]
        public async Task<ResponseMessageModel> GetTreeModule([FromQuery] SysModuleSearchInput input)
        {
            return Success(await _sysmoduleservice.GetTreeModule(input));
        }

        /// <summary>
        /// 查询单个菜单及下级按钮信息√
        /// </summary>
        /// <param name="key"></param>
        /// <returns></returns>
        [Route("getsysmodulesingle"), HttpGet]
        public async Task<ResponseMessageModel> GetSysModuleSingle( string mdlcode)
        {
            var data= await _sysmoduleservice.GetSysModuleSingle(mdlcode);
            return Success(data);
        }


    }
}
